import App from './App.vue'
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
import VHtmlPlugin from '@megalo/vhtml-plugin'
import filters from './utils/filters'
import store from './store/index'
import globalData from './utils/GlobalData'
import http from './utils/HttpClient'

Vue.use(VHtmlPlugin)
Vue.use(filters)
Vue.prototype.$globalData = globalData
Vue.prototype.$http = http
Vue.prototype.$store = store

// https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/page.html
Component.registerHooks([
  'onLoad', // 监听页面加载
  'onShow', // 监听页面显示
  'onReady', // 监听页面初次渲染完成
  'onHide', // 监听页面隐藏
  'onUnload', // 监听页面卸载
  'onPullDownRefresh', // 监听用户下拉动作
  'onReachBottom', // 页面上拉触底事件的处理函数
  'onShareAppMessage', // 用户点击右上角分享
  'onPageScroll', // 页面滚动
  'onTabItemTap' // 当前是 tab 页时， 点击 tab 时触发
])

const app = new Vue(App)

app.$mount()

export default {
  config: {
    // pages 的首个页面会被编译成首页
    pages: ['pages/hello/hello', 'pages/account/register', 'pages/taskcontent/index'],
    subPackages: [
      {
        root: 'student',
        pages: [
          'index',
          'pages/tasks/index',
          'pages/tasks/create0',
          'pages/tasks/create1'
        ]
      },
      {
        root: 'teacher',
        pages: [
          'index',
          'pages/tasks/index',
          'pages/history/index'
        ]
      },
      {
        root: 'admin',
        pages: [
          'index',
          'pages/tasks/index',
          'pages/teacher-admin/content',
          'pages/student-admin/content'
        ]
      }
    ],
    tabBar: {
      color: '#333',
      selectedColor: '#007d37',
      list: [
        {
          pagePath: 'pages/hello/hello'
        },
        {
          pagePath: 'pages/account/register'
        }
      ]
    },
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: '金地集团',
      navigationBarTextStyle: 'black'
    },
    usingComponents: {
      'van-tabbar': '/static/vant/tabbar/index',
      'van-tabbar-item': '/static/vant/tabbar-item/index',
      'van-button': '/static/vant/button/index',
      'van-icon': '/static/vant/icon/index',
      'van-field': '/static/vant/field/index',
      'van-tag': '/static/vant/tag/index',
      'van-cell': '/static/vant/cell/index',
      'van-cell-group': '/static/vant/cell-group/index',
      'van-panel': '/static/vant/panel/index',
      'van-rate': '/static/vant/rate/index',
      'van-tabs': '/static/vant/tabs/index',
      'van-tab': '/static/vant/tab/index',
      'van-dialog': '/static/vant/dialog/index',
      'van-datetime-picker': '/static/vant/datetime-picker/index',
      'van-popup': '/static/vant/popup/index',
      'van-area': '/static/vant/area/index',
      'van-picker': '/static/vant/picker/index',
      'ec-canvas': '/static/ec-canvas/ec-canvas'
    }
  }
}
